package com.zhl.excel;

import com.alibaba.excel.EasyExcel;
import org.junit.Test;

import java.io.File;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

/**
 * @program: demos
 * @description:
 * @author: 刘振华
 * @create: 2020-09-24 12:00
 **/

public class EasyExcelDemo {
	public static Map<String, Set<String>> map = new HashMap<>();
	public static int len = "70000049442".length();
	public static Set<String> set = new HashSet<>();
	@Test
	public void readExcel(){
//		String path = "D:\\work\\文档\\3.塔里木\\数据库\\A5对应关系结果";
		String path = "D:\\work\\文档\\3.塔里木\\数据库\\ERP设备台账20200513.xlsx";
		EasyExcel.read(path, DateEo.class, new ExcelListener())
			.sheet().doRead();
//		map(path);
//		System.out.println(set.size());
//		map.forEach((k,v)->{
//			if(v.size()>1){
//				System.out.println(k+":"+v);
//			}
//		});
//		System.out.println(new Date(1601194760834l));
//		System.out.println(new Date(1601285601032l));
	}

	private void map(String path){
		File mainPath = new File(path);
		for(File tmpPath : mainPath.listFiles()){
			if(tmpPath.isDirectory()) {
				System.out.println(tmpPath.getName());
				for (File file : tmpPath.listFiles()) {
					if(file.getName().endsWith(".xls")) {
						System.out.println(file.getName());
						EasyExcel.read(file, CyYycysbEo.class, new ExcelListener(file))
							.sheet().doRead();
					}
				}
			}
		}
	}
}
